package com.chinacoal.microservice;

import com.alibaba.fastjson.JSONObject;
import com.chinacoal.microservice.fallback.CostManagementClientFallback;
import com.chinacoal.microservice.pojo.*;
import com.chinacoal.microservice.util.QueryCriteria;
import com.chinacoal.microservice.util.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignAutoConfiguration;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletResponse;
import java.util.List;


/**
 * @author zhuliang
 * @version V1.0
 * @Description: 运维模块-费用管理
 * @date 2020-11-25 20：00
 */
@FeignClient(name = "${spring.application.name}",fallback = CostManagementClientFallback.class,configuration = FeignAutoConfiguration.class)
@Api(tags = {"运维模块-费用管理"})
public interface CostManagementClient {

    /**
     * @Description: 查询所有的费用信息(带分页)
     * @author zhuliang
     * @date 2020/11/27 9:50
     */
    @ApiOperation(value = "查询所有的费用信息(带分页)")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "body", name = "queryCriteria", value = "查询条件实体", required = true, dataType = "QueryCriteria"),
            @ApiImplicitParam(paramType = "header", name = "token", value = "令牌", required = true, dataType = "String")
    })
    @PostMapping("smartleasing/cost/getAllByExpenseManag")
    public Result<List<CcmsSmartleasingExpenseManag>> getAllByExpenseManag(@RequestBody QueryCriteria queryCriteria,
                                                                           @RequestHeader("token") String token);

    /**
     * @Description: 条件查询所有的费用信息(带分页)
     * @author zhuliang
     * @date 2020/11/27 10:36
     */
    @ApiOperation(value = "条件查询所有的费用信息(带分页)")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "body", name = "queryCriteria", value = "查询条件实体", required = true, dataType = "QueryCriteria"),
            @ApiImplicitParam(paramType = "header", name = "token", value = "令牌", required = true, dataType = "String")
    })
    @PostMapping("smartleasing/cost/getAllExpenseManagByCondition")
    public Result<List<CcmsSmartleasingExpenseManag>> getAllExpenseManagByCondition(@RequestBody QueryCriteria queryCriteria,
                                                                                    @RequestHeader("token") String token);

    /**
     * @Description: 通过费用信息id查询费用详情
     * @author liule
     * @date 2022/10/09
     */
    @ApiOperation(value = "通过费用信息id查询关联历史付费")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "path", name = "fkExpenseManagId", value = "费用信息外键id", required = true, dataType = "String"),
            @ApiImplicitParam(paramType = "header", name = "token", value = "令牌", required = true, dataType = "String")
    })
    @GetMapping("smartleasing/cost/getHistoricalPaymentsByExpenseManagId/{pkExpenseManagId}")
    public Result<List<CcmsSmartleasingHistoricalPayment>> getHistoricalPaymentsByExpenseManagId(@PathVariable(value = "pkExpenseManagId") String fkExpenseManagId, @RequestHeader("token") String token);

    /**
     * @Description: 通过费用信息id查询费用详情
     * @author zhuliang
     * @date 2020/11/27 11:33
     */
    @ApiOperation(value = "通过费用信息id查询费用详情")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "path", name = "fkExpenseManagId", value = "费用信息外键id", required = true, dataType = "String"),
            @ApiImplicitParam(paramType = "header", name = "token", value = "令牌", required = true, dataType = "String")
    })
    @GetMapping("smartleasing/cost/getNoticeByContractId/{pkExpenseManagId}")
    public Result<CcmsSmartleasingNotice> getNoticeByContractId(@PathVariable(value = "pkExpenseManagId") String fkExpenseManagId,
                                                                @RequestHeader("token") String token);

    /**
     * @Description: 通过费用信息id得到要抄表所需要回显的信息
     * @author zhuliang
     * @date 2020/11/27 13:59
     */
    @ApiOperation(value = "通过费用信息id得到要抄表所需要回显的信息")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "path", name = "pkExpenseManagId", value = "费用信息外键id", required = true, dataType = "String"),
            @ApiImplicitParam(paramType = "header", name = "token", value = "令牌", required = true, dataType = "String")
    })
    @GetMapping("smartleasing/cost/meterReadingByExpenseManagId/{pkExpenseManagId}")
    public Result<CcmsSmartleasingExpenseManag> meterReadingByExpenseManagId(@PathVariable(value = "pkExpenseManagId") String pkExpenseManagId,
                                                                             @RequestHeader("token") String token);

    /**
     * @Description: 录入抄表信息
     * @author zhuliang
     * @date 2020/11/27 14:24
     */
    @ApiOperation(value = "录入抄表信息")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "body", name = "expenseEntry", value = "费用录入实体(水电煤)", required = true, dataType = "CcmsSmartleasingExpenseEntry"),
            @ApiImplicitParam(paramType = "header", name = "token", value = "令牌", required = true, dataType = "String")
    })
    @PostMapping("smartleasing/cost/updateMeterReadingInformation")
    public Result addMeterReadingInformation(@RequestBody CcmsSmartleasingExpenseEntry expenseEntry,
                                             @RequestHeader("token") String token);

    @ApiOperation(value = "批量导入抄表信息")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "body", name = "file", value = "批量导入数据", required = true, dataType = "File"),
            @ApiImplicitParam(paramType = "header", name = "token", value = "令牌", required = true, dataType = "String")
    })
    @PostMapping("smartleasing/cost/importMeterReadingInformations")
    public Result importMeterReadingInformations(MultipartFile file,@RequestHeader("token") String token);

    @ApiOperation(value = "导出模板")
    @GetMapping("smartleasing/cost/downloadTempFile")
    public void downloadTemplateFile(HttpServletResponse response,String token) ;


    @ApiOperation(value = "扎帐")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "header", name = "token", value = "令牌", required = true, dataType = "String")
    })
    @GetMapping("smartleasing/cost/expenseLock")
    public Result lockCost(@RequestHeader("token")String token) ;

    /**
     * @Description: 缴费
     * @author zhuliang
     * @date 2020/11/10 14:36
     */
    @ApiOperation(value = "缴费")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "body", name = "notice", value = "费用信息实体", required = true, dataType = "CcmsSmartleasingExpenseManag"),
            @ApiImplicitParam(paramType = "header", name = "token", value = "令牌", required = true, dataType = "String")
    })
    @PostMapping("smartleasing/cost/pay")
    public Result pay(@RequestBody CcmsSmartleasingExpenseManag expenseManag,
                      @RequestHeader("token") String token);

    /**
     * @Description: 审核的回显信息获取
     * @author zhuliang
     * @date 2020/12/5 10:00
     */
    @ApiOperation(value = "审核的回显信息获取")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "path", name = "pkExpenseManagId", value = "费用信息id", required = true, dataType = "String"),
            @ApiImplicitParam(paramType = "header", name = "token", value = "令牌", required = true, dataType = "String")
    })
    @GetMapping("smartleasing/cost/getAuditEcho/{pkExpenseManagId}")
    public Result<CcmsSmartleasingNotice> getAuditEcho(@PathVariable(value = "pkExpenseManagId") String pkExpenseManagId,
                                                       @RequestHeader("token") String token);

    /**
     * @Description: 抄表审核
     * @author zhuliang
     * @date 2020/12/5 11:01
     */
    @ApiOperation(value = "抄表审核")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "body", name = "expenseEntry", value = "费用录入实体类", required = true, dataType = "CcmsSmartleasingExpenseEntry"),
            @ApiImplicitParam(paramType = "header", name = "token", value = "令牌", required = true, dataType = "String")
    })
    @PostMapping("smartleasing/cost/meterReadingReview")
    public Result meterReadingReview(@RequestBody CcmsSmartleasingExpenseEntry expenseEntry,
                                     @RequestHeader("token") String token);

    /**
     * @Description: 线下开票
     * @author zhuliang
     * @date 2020/12/5 17:53
     */
    @ApiOperation(value = "线下开票")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "body", name = "expenseManag", value = "费用信息实体类", required = true, dataType = "CcmsSmartleasingExpenseManag"),
            @ApiImplicitParam(paramType = "header", name = "token", value = "令牌", required = true, dataType = "String")
    })
    @PostMapping("smartleasing/cost/offlineInvoicing")
    public Result offlineInvoicing(@RequestBody CcmsSmartleasingExpenseManag expenseManag,
                                   @RequestHeader("token") String token);

    /**
     * @Description: 通过费用信息id的字符串集合来进行开票
     * @author zhuliang
     * @date 2020/11/10 14:36
     */
    @ApiOperation(value = "通过费用信息id的字符串集合来进行开票")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "path", name = "pkExpenseManagId", value = "费用信息id", required = true, dataType = "String"),
            @ApiImplicitParam(paramType = "header", name = "token", value = "令牌", required = true, dataType = "String")
    })
    @GetMapping("smartleasing/cost/invoicing/{pkExpenseManagId}")
    public Result invoicing(@PathVariable(value = "pkExpenseManagId") String pkExpenseManagId,
                            @RequestHeader("token") String token);

    /**
     * @Description: 得到发票接口返回值
     * @author zhuliang
     * @date 2021/2/1 15:27
     */
    @ApiOperation(value = "得到发票接口返回值")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", name = "result", value = "发票信息返回值", required = true, dataType = "String"),
            @ApiImplicitParam(paramType = "header", name = "token", value = "令牌", required = true, dataType = "String"),
            @ApiImplicitParam(paramType = "query", name = "orderNumber", value = "发票订单号", required = true, dataType = "String")
    })
    @PostMapping("smartleasing/cost/getInvoicing")
    public Result getInvoicing(@RequestParam("result") String result,
                               @RequestHeader("token") String token,
                               @RequestParam("orderNumber") String orderNumber);

    @ApiOperation(value = "导出汇总表")
    @GetMapping("smartleasing/cost/exportSummaryReport")
    public void exportSummaryReport(HttpServletResponse response,@RequestParam("startDate") String startDate,@RequestParam("endDate") String endDate, @RequestParam("areaNumberIds") List<String> areaNumberIds,@RequestParam("token") String token);

    @ApiOperation(value = "导出客户汇总表")
    @GetMapping("smartleasing/cost/exportSummaryReportByClient")
    public void exportSummaryReportByClient(HttpServletResponse response,@RequestParam("startDate") String startDate,@RequestParam("endDate") String endDate, @RequestParam("areaNumberIds") List<String> areaNumberIds,@RequestParam("token") String token);

    @ApiOperation(value = "导出欠款明细表")
    @GetMapping("smartleasing/cost/exportDebtDetailReport")
    public void exportDebtDetailReport(HttpServletResponse response,@RequestParam("startDate") String startDate, @RequestParam("areaNumberIds") List<String> areaNumberIds,@RequestParam("token") String token);
}
